#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#define PATH_FIFO "/home/yujiu/fifo"
int main(){
	int fd= open(PATH_FIFO,O_WRONLY);
	char buf[128];
	ssize_t res=0;
	while(1){
		memset(buf,0,sizeof(buf));
		fgets(buf,sizeof(buf),stdin);
		res=write(fd,buf,strlen(buf));
		if(strncmp(buf,"exit",4)==0)break;
		if(res<=0)break;
	}
	close(fd);
	return 0;
}
